from http.client import responses

import config
import requests
import unittest
from api.communicateReportFormTeacher import ReportFormTeacher
from lib.log import Log


class getCommucateReport(unittest.TestCase):
    def setUp(self):
        self.session = requests.session()

    def tearDown(self):
        self.session.close()

    def test01_getCommucateReport(self):
        param = {"service_name": "nkotech.CommunicateProvider.ReportFormTeacher",
                 "param": {"dto": {"condition": {"year": 2025}, "page": 1, "pageSize": 20, "needTotal": True}}}
        try:
            respones = ReportFormTeacher().communicateReport(self.session, param, config.TOKEN_RESULT[0].get("xhx_token"))
            if responses:
                print(respones.json())

            else:
                print("None respones")
        except Exception as e:
            Log(e)
            print(f"错误信息：{e}")

        self.assertEqual("ok", respones.json().get("msg"))